Skip to content

Conversation

viccie30
Copy link
Contributor

@viccie30 viccie30 commented Jan 5, 2025

This builds on mkdocstrings/griffe#348 to document generic types, functions and type aliases.

The first commit makes a small change that the next commit builds upon. Because of the churn in tests, I've separated that commit.

I have added documentation, but not yet tests. This can probably only be merged once mkdocstrings/griffe#348 is merged.

@pawamoy
Copy link
Member

pawamoy commented Aug 19, 2025

I'll be working on this in the next few days, expect to see modifications coming in.

I wasn't fond of the new format_class and format_merged_init rendering utilities, because essentially what we want to do when merging the __init__ method into the class docs is to either:

  • concatenate the type parameters of both the class and init method:

    class Foo[T][U](param1: T, param2: U)

    ...but that might prevent formatting by Black/Ruff if it's invalid syntax (I'm not sure it is)

  • or actually merge/combine the type parameters together:

    class Foo[T, U](param1: T, param2: U)

    ...even if that's not entirely true, because as long as each type parameter cross-links to the right symbol, I think it's good.

@pawamoy pawamoy marked this pull request as ready for review August 26, 2025 12:09
 Please enter a commit message to explain why this merge is necessary,
Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK LGTM now! Thank you so much again @viccie30 for your work on this!

@pawamoy pawamoy merged commit dc8c3ad into mkdocstrings:main Aug 26, 2025
17 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants